import {addToCart} from '@/ajax'
const state = {
  
}
const actions = {
  async addTocart({commit},skuObj) {
    const {skuId,skuNum} = skuObj
    const result = await addToCart(skuId,skuNum)
    if(result.code === 200) {
      //返回一个值为ok的Promise对象
      
    }else{
      //返回一个值为添加失败的Promise对象
      return Promise.reject(new Error('添加失败'))
    }
  }
}
const mutations = {

}
const getters = {
  
}
export default {
  state,
  actions,
  mutations,
  getters
}